
<div class="box box-primary">
 <div class="box-header with-border">
  <div id="mainpanel" style="margin: 0px 0px 0px 0px;">
   <div id="mapcontent" style="width: 100%;position: relative;">
   
   <!-- tools area start-->
   
  <div class="box-body" style="width: 100%">
    <div class="row">
    <div class="col-xs-3">
    <div class="input-group">
      <span class="input-group-addon" id="sizing-addon1">厂商名称</span>
        <input id="manufName" type="text" class="form-control" aria-describedby="sizing-addon1">
      </div>
    </div>
    
    <div class="col-xs-3">
    <div class="input-group">
      <span class="input-group-addon" id="sizing-addon2">厂商类型</span>
        <select id="manufSelect" class="form-control" aria-describedby="sizing-addon2">
          <option value="0">所有厂商</option>
          <option value="1">配件厂商</option>
          <option value="2">终端厂商</option>
          <option value="3">维保厂商</option>
        </select>
      </div>
    </div>


    <div class="col-xs-1">      
      <button type="button" class="btn  btn-default" onclick="condictionsSearch()">
      <i class="fa fa-search"></i> 搜索</button>
    </div>
    </div>
  </div>
 
<!--   <div class="box-body" style="width: 100%">
					<div class="row">
						<div class="col-xs-4">
							<button class="btn btn-success" id="add">
							<i class="fa fa-plus-circle fz"></i> 新增</button>
							<button class="btn btn-warning" id="edit">
							<i class="glyphicon glyphicon-pencil"></i> 编辑</button>
							<button class="btn btn-danger" id="del">
							<i class="fa fa-trash"></i> 删除</button>
						</div>
						
					</div>
				</div> -->
				
		<div class="box-header with-border">
				  <div class="box-body" style="width: 100%">
					<div class="row">
						<#list btnlist as items>
							<button class="${items.funcBg!}" id="${items.funcCode!}">
							<i class="${items.funcIcon!}"></i> ${items.funcName!}</button>
						
						</#list>
						
					</div>
				</div>	
				</div>
				
				
          
   <!-- tools area end-->

	<!-- DataTable主体 -->
	<div class="box-body" >
	<table id="table_form" class="table table-bordered table-striped table-hover" cellspacing="0" width="100%">
	</table>
	</div>

	</div>
  </div>
 </div>
</div>


<!-- dataTable及浮态框相关js -->
<!--<script src="${request.contextPath}/lib/plugins/select2/select2.full.min.js"></script>-->
<!--<script type="text/javascript" src="${request.contextPath}/js/aboutForm.js"></script>-->
<script type="text/javascript"src="${request.contextPath}/js/manuf/tableCreation.js"></script>

<script>
   
function condictionsSearch(){

		var manufName=$("#manufName").val();
		var manufType=$("#manufSelect").val();
		var url=contextPath + "/soa/manuf/datas/search";
	    var params= {};
	       if(manufType!=0){
	    	   params.manufName = manufName; 
		       params.manufType = manufType; 
	       }else{
	    	   params.manufName = manufName; 
	       }
	       
     //aboutForm。js里
	      refreshData(url,params);
	  }



//操作方法
$(function(){

	//新增
	$('#add').on('click',function(){
		post("/soa/manuf/inst","html","",function(obj){
			//console.log(obj);
			var d = dialog({
				title : '新增厂商信息',
				content :obj,					
				width : 550,
				height : 500,
				okValue: '保存',
				zIndex:1050,
				ok : 
					function() {
					var window = this;
					this.title('正在提交..');
					ajaxSubmit($('#form_submit')[0], function(data){
			            //alert(data);
			        });
					
					setTimeout(function() {
						DTrefresh();
						window.close().remove();
					}, 100);
					return false;
				 cancel: false
				},
		     cancelValue:'取消',
			 cancel: function() {
			  }
			});
			d.showModal();
		});
		
	});

	//编辑
	$('#edit').on('click',function(){
		var $table = table.table().node();
		var $chkbox_all = $('tbody input[type="checkbox"]', $table);
		var $chkbox_checked = $('tbody input[type="checkbox"]:checked', $table);
		if($chkbox_checked.length<1){
			var d = dialog({
				title:'提示',
				content : '请勾选要修改的记录！'
			});
			d.show();
			setTimeout(function() {
				d.close().remove();
			}, 2000);
		}else
		if($chkbox_checked.length>1){
			var d = dialog({
				title:'提示',
				content : '请不要勾选多条记录修改！'
			});
			d.show();
			setTimeout(function() {
				d.close().remove();
			}, 2000);
		}else{
			var data={"id":$chkbox_checked.val()};
			var id=$chkbox_checked.val();
			post("/soa/manuf/edit","html",data,function(obj){
				//console.log(obj);
				var d = dialog({
					title : '编辑厂商信息',
					content :obj,					
					width : 550,
					height : 500,
					okValue: '保存',
					zIndex:1050,
					ok : 
						function() {
						var that = this;
						this.title('正在提交..');
						ajaxSubmit($('#form_submit')[0], function(data){
				          
				        });
						
						
						 //updateUser(id);
						setTimeout(function() {
							DTrefresh();
							that.close().remove();
						}, 100);
						return false;
					 cancel: false
					},
			     cancelValue:'取消',
				 cancel: function() {
					 
				  }
				});
				d.showModal();
			});
		}

	});
	

	//删除
	$('#del').on('click',function(){
		var $table = table.table().node();
		var $chkbox_all = $('tbody input[type="checkbox"]', $table);
		var $chkbox_checked = $('tbody input[type="checkbox"]:checked', $table);
		
		var data={"id":$chkbox_checked.val()};
		var id=$chkbox_checked.val();
		
		if($chkbox_checked.length<1){
		var t = dialog({
			title:'提示',
			content : '请勾选要删除的记录！'
		});
		t.show();
		setTimeout(function() {
			t.close().remove();
		}, 2000);
	    }else if($chkbox_checked.length>1){
			var t = dialog({
				title:'提示',
				content : '暂无删除多条记录权限'
			});
			t.show();
			setTimeout(function() {
				t.close().remove();
			}, 2000);
		    }else{
			//alert(id);//测试可拿到id
			var d = dialog({
	             title:'提示',
	             content:'确认删除id为：'+id+' 的这条记录？',
	             okValue:'确认',
	             ok:function(){
	            	 var that=this;
	            	 var url='/soa/manuf/datas/del';
	            	 delObject(id,url);
	            	setTimeout(function() {
	            		DTrefresh();
						that.close().remove();
					}, 200);
	            	
	             },
	             cancelValue:'取消',
	             cancel:function(){
	            	 
	             }
				
			});
			d.showModal();	
	    }


	});

});

</script>
<style>
td.details-control {
    cursor: pointer;    
}
tr.shown td.details-control {
   
}
      
   .showTip { width:300px; border-radius: 5px; background: #000; opacity:0.8;}
   .showTipcon { padding:5px; }
   .showTipcon p {color: #fff; }


  #example_wrapper { margin-top: 30px; }  
  #example_wrapper .btn-group .btn { margin-right: 15px; border-radius: 3px; color: #fff }

  .wb-col { float: left; width:70%; }
  .n-tect { float: left; line-height: 34px; }
   
</style>